import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;

/**
 * 常见元素处理 input
 */
public class ActionSelenium02 {
    public WebDriver driver;
    //初始化
    public void InitDriver(){
        //驱动配置
        System.setProperty("webdriver.edge.marionette","D:\\Enviroments\\geckodriver-v0.26.0-win64\\geckodriver.exe");
        //创建对象
        driver = new EdgeDriver();
        //打开慕课网登录网页
        driver.get("https://www.imooc.com/user/newlogin/form_url/");
        //网页窗口最大化
        driver.manage().window().maximize();
        //自动登录
        driver.findElement(By.name("email")).sendKeys("2370447196@qq.com");
        driver.findElement(By.name("password")).sendKeys("zdy18365186609");
        driver.findElement(By.className("moco-btn moco-btn-red moco-btn-lg btn-full xa-login")).click();
    }
    //实现文本框的属性方法
    public void InputBox(){
        //填写信息
        driver.findElement(By.name("email")).sendKeys("2370447196@qq.com");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //获取定位文本框中信息
        String s = driver.findElement(By.name("email")).getAttribute("placeholder");
        System.out.println(s);
        driver.findElement(By.name("email")).clear();
    }


    public static void main(String[] args) {
        ActionSelenium02 as = new ActionSelenium02();
        as.InitDriver();
        as.InputBox();
    }
}
